package com.woniu.until;

public class ResultData<T> {
    private int code; // 状态码
    private String message; // 消息
    private T data; // 数据

    public ResultData(int code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }


    // 成功返回结果
    public static <T> ResultData<T> success(T data) {
        return new ResultData<>(200, "请求成功", data);
    }

    // 失败返回结果
    public static <T> ResultData<T> fail(String message) {
        return new ResultData<>(500, message, null);
    }
}
